Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

date-format

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-format

Formatting Date objects as strings since 2013

  • 4.0.14
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-56.57%
Maintainers
2
Weekly downloads
 
Created

What is date-format?

The date-format npm package is a simple utility for formatting dates in JavaScript. It allows you to format dates in various patterns, making it easier to display dates in a human-readable format or in a specific format required by your application.

What are date-format's main functionalities?

Basic Date Formatting

This feature allows you to format a date object into a string with a specified pattern. In this example, the current date is formatted as 'yyyy-MM-dd'.

const dateFormat = require('date-format');
const now = new Date();
console.log(dateFormat('yyyy-MM-dd', now));

Custom Date Formatting

This feature allows you to create custom date formats. In this example, the current time is formatted to show hours, minutes, seconds, and milliseconds.

const dateFormat = require('date-format');
const now = new Date();
console.log(dateFormat('hh:mm:ss.SSS', now));

Predefined Date Formats

This feature provides predefined date formats for common use cases. In this example, the current date and time are formatted in ISO 8601 format.

const dateFormat = require('date-format');
const now = new Date();
console.log(dateFormat.asString(dateFormat.ISO8601_FORMAT, now));

Other packages similar to date-format

Keywords

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc